function results = multipleRegression(xMin,xMax,initProba,eps,workspace)


eval(['load ' workspace]);
variables = who('A*');

global results

for i=1:length(variables)
    values = eval([char(variables(i))]);
    x = values(:,1);
    y = values(:,2);
    
    x = x(x>xMin); 
    y = y(x>xMin);
    
    x = x(x<xMax);
    y = y(x<xMax);
    
    logX = log(x);
    logY = log(y);
    
    stats = regstats(logY,logX,'linear',{'beta' 'mse' 'yhat'});
    
    % compute r-squared
    yhat = stats.yhat;
    RSS = sum((yhat-mean(y)).^2); % regression sum of squares
    TSS = sum((y-mean(y)).^2); % total sum of squares
    rSquared = RSS ./ TSS;  
    
    results(i,1) = initProba + eps * (i-1);
    results(i,2) = stats.beta(2);
    results(i,3) = rSquared;
    results(i,4) = stats.mse;
    %results(i,:) = [initProba + eps * (i-1), stats.beta(2), rSquared];
    %i/(size(variables))*100 
end

 plot(results(:,1),results(:,3),'.k',results(:,1),results(:,4),':b')